<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline' 'self';">
    <script src="/docs/node_modules/@bugsnag/browser/dist/bugsnag.min.js"></script>
    <script type="text/javascript">
      var NOTIFY = decodeURIComponent(window.location.search.match(/NOTIFY=([^&]+)/)[1])
      var SESSIONS = decodeURIComponent(window.location.search.match(/SESSIONS=([^&]+)/)[1])
      var API_KEY = decodeURIComponent(window.location.search.match(/API_KEY=([^&]+)/)[1])
      var bugsnagClient = Bugsnag.createClient({
        apiKey: API_KEY,
        endpoints: {
          notify: NOTIFY,
          sessions: SESSIONS
        },
        autoDetectErrors: false
      })
    </script>
  </head>
  <body>
    <pre id="bugsnag-test-state">PENDING</pre>
    <script>
      setTimeout(function () {
        var el = document.getElementById('bugsnag-test-state')
        // if the CSP violation caused bugsnag not to init, bugsnagClient won't be defined
        el.textContent = el.innerText = (bugsnagClient ? 'DONE' : 'ERROR')
      }, 100)
    </script>
  </body>
</html>
